home *** CD-ROM | disk | FTP | other *** search
- raygun = function()
- {
- this.onLoad = function()
- {
- this.frame = _root._currentframe;
- };
- this.onEnterFrame = function()
- {
- if(_root._currentframe != this.frame)
- {
- this.removeMovieClip();
- }
- if(!this.watcher)
- {
- if(this.hitTest(_root.hero))
- {
- _root.reallife -= 15;
- _root.life = Math.round(_root.reallife);
- _root.endcheck();
- if(_root[this.shooter]._x < _root.hero._x)
- {
- _root.hero.xchange = 50;
- }
- else
- {
- _root.hero.xchange = -50;
- }
- this.stop();
- this.explode.play();
- this.watcher = true;
- }
- else
- {
- _root.hero.xchange = 0;
- }
- }
- };
- };
- raygun.prototype = new MovieClip();
- Object.registerClass("ray",raygun);
- Object.registerClass("thugbullet",raygun);
- findlife = function()
- {
- this.onLoad = function()
- {
- this.name = this._name.slice(-1);
- this.checker = this._name.slice(-2,-1);
- this.checker = Number(this.checker);
- if(this.checker > 0)
- {
- this.name = this._name.slice(-2);
- }
- this.name = Number(this.name);
- if(!_root.lifearray[this.name])
- {
- this.gotoAndStop(2);
- }
- delete this.checker;
- };
- this.onEnterFrame = function()
- {
- if(this.hitTest(_root.hero))
- {
- _root.reallife += 15;
- if(_root.reallife > 100)
- {
- _root.reallife = 100;
- }
- _root.life = Math.round(_root.reallife);
- _root.lifearray[this.name] = false;
- _root.score += 6;
- this.gotoAndStop(2);
- delete this.onEnterFrame();
- }
- };
- };
- findlife.prototype = new MovieClip();
- Object.registerClass("extralife",findlife);
- alienmove = function()
- {
- this.onLoad = function()
- {
- _this._xscale = 100;
- this._yscale = 100;
- high = 50;
- h_width = 25;
- this.move = -2;
- this.x = this._x;
- _root.maptest(this._name);
- };
- this.onEnterFrame = function()
- {
- if(Math.abs(this._x - _root.hero._x) < 15)
- {
- this.move = 0;
- this.stop();
- if(this._x > hero._x)
- {
- this._xscale = 100;
- }
- else
- {
- this._xscale = -100;
- }
- }
- else
- {
- if(this.hitTest(_root.hero))
- {
- _root.reallife -= 0.5;
- _root.life = Math.round(_root.reallife);
- _root.endcheck();
- }
- if(this._x > this.maxx)
- {
- if(_root.hero._x > this._x)
- {
- this.move = 0;
- this.stop();
- }
- else
- {
- this._xscale = 100;
- this.move = -2;
- }
- }
- else if(this._x < this.minx)
- {
- if(_root.hero._x < this._x)
- {
- this.move = 0;
- this.stop();
- }
- else
- {
- this._xscale = -100;
- this.move = 2;
- }
- }
- else if(_root.hero._x > this._x)
- {
- this._xscale = -100;
- this.move = 2;
- this.play();
- }
- else if(_root.hero._x < this._x)
- {
- this._xscale = 100;
- this.move = -2;
- this.play();
- }
- }
- this.x += this.move;
- this._x = this.x;
- };
- };
- alienmove.prototype = new MovieClip();
- Object.registerClass("alien",alienmove);
- spikewatch = function()
- {
- this.onEnterFrame = function()
- {
- if(!this.timeon)
- {
- if(this.hitTest(_root.hero))
- {
- _root.hero._visible = 0;
- this.gotoAndStop(2);
- this.colour = _root.herocolor.getRGB();
- this.impalecolour = new Color(this.impile2);
- this.impalecolour.setRGB(this.colour);
- this.timeon = true;
- }
- }
- else
- {
- _root.reallife = 0;
- _root.life = 0;
- this.timer = this.timer + 1;
- if(this.timer > 60)
- {
- _root.life = 0;
- _root.impile.gotoAndStop(1);
- _root.endcheck();
- }
- }
- };
- };
- spikewatch.prototype = new MovieClip();
- Object.registerClass("spikes",spikewatch);
- paniwatch = function()
- {
- this.onLoad = function()
- {
- this.gotoAndPlay(Math.round(Math.random() * 20));
- };
- this.onEnterFrame = function()
- {
- if(this.hitTest(_root.hero))
- {
- _root.reallife -= 0.5;
- _root.life = Math.round(_root.reallife);
- _root.endcheck();
- }
- };
- };
- paniwatch.prototype = new MovieClip();
- Object.registerClass("pani",paniwatch);
- swarm = function()
- {
- this.onLoad = function()
- {
- this.swarmcolour = new Color(this.swarm);
- this.shapeX = this._x;
- this.shapeY = this._y;
- this.targetX = 0;
- this.targetY = 0;
- this.oldTargetX = 0;
- this.FlockX = Math.random() * 200 - 100;
- this.FlockY = Math.random() * 200 - 100;
- this.move = true;
- };
- this.onEnterFrame = function()
- {
- if(this.move)
- {
- if(!_root.homing)
- {
- this.targetX = _root.hero._x;
- this.targetY = _root.hero._y;
- }
- else if(!this.run)
- {
- this.run = true;
- this.targetX = Math.random() * 400;
- this.targetY = Math.random() * 700;
- }
- else
- {
- this.targetX += 100 - Math.random() * 200;
- this.targetY += 100 - Math.random() * 200;
- }
- this.distX = this.targetX - this.shapeX + this.FlockX;
- this.distY = this.targetY - this.shapeY + this.FlockY;
- if(this.targetX == this.oldTargetX && Math.random() > 0.9)
- {
- this.FlockX = Math.random() * 100 - 50;
- this.FlockY = Math.random() * 100 - 50;
- }
- else if(this.targetX != this.oldTargetX && Math.random() > 0.8)
- {
- this.FlockX = Math.random() * 400 - 200;
- this.FlockY = Math.random() * 400 - 200;
- }
- this.shapeX = Math.round(this.shapeX + this.DistX / 15);
- this.shapeY = Math.round(this.shapeY + this.DistY / 15);
- _root.maptest(this._name);
- if(this.shapeX - this._width / 2 < this.minx)
- {
- this.shapeX = this.minx + this._width / 2;
- }
- else if(this.shapeX + this._width / 2 > this.maxx)
- {
- this.shapeX = this.maxx - this._width / 2;
- }
- if(this.shapeY + this._height / 2 > this.miny)
- {
- this.shapeY = this.miny - this._height / 2;
- }
- else if(this.shapeY - this._height / 2 < this.maxy)
- {
- this.shapeY = this.maxy + this._height / 2;
- }
- this._x = this.shapeX;
- this._y = this.shapeY;
- this.oldTargetX = this.targetX;
- if(this.hitTest(_root.hero))
- {
- this.swarmcolour.setRGB(10682625);
- _root.reallife -= 0.5;
- _root.life = Math.round(_root.reallife);
- _root.endcheck();
- }
- else
- {
- this.swarmcolour.setRGB(0);
- }
- }
- };
- };
- swarm.prototype = new MovieClip();
- Object.registerClass("swarmer",swarm);
- bulletmove = function()
- {
- this.frame = _root._currentframe;
- this.swarmno = _root.swarmarray[scene][0];
- if(this.swarmno == "alien")
- {
- this.swarmno = 0;
- }
- if(_root.bulletnum == 1)
- {
- this.onLoad = function()
- {
- _root.maptest(this._name);
- this.speed = 20;
- };
- this.onEnterFrame = function()
- {
- if(_root._currentframe != this.frame)
- {
- this.removeMovieClip();
- }
- this._x += this.speed * this.x;
- this._y += this.speed * this.y;
- this.speed += 1;
- if(this._x < this.minx || this._x > this.maxx || this._y > this.miny || this._y < this.maxy)
- {
- this.removeMovieClip();
- }
- if(this.swarmno == 0)
- {
- if(this.hitTest(_root.alien))
- {
- _root.alien.attachMovie("blowup","blowup",10000);
- _root.enemies += 1;
- _root.alien.gotoAndStop("off");
- _root.score += 10;
- _root.swarmarray[_root.scene] = 0;
- this.removeMovieClip();
- }
- }
- else
- {
- i = 1;
- while(i <= this.swarmno)
- {
- if(this.hitTest(_root["swarm" + i]))
- {
- if(_root["swarm" + i].move)
- {
- _root.enemies += 1;
- _root["swarm" + i].move = false;
- _root["swarm" + i].attachMovie("blowup","blowup",10000);
- _root.swarmarray[_root.scene][0] -= 1;
- _root.score += 10;
- this.removeMovieClip();
- }
- }
- i++;
- }
- }
- };
- }
- else if(_root.bulletnum == 2)
- {
- this.onLoad = function()
- {
- this.speed = 30;
- this.timer = 100;
- this.mx = this._x;
- this.my = this._y;
- };
- this.onEnterFrame = function()
- {
- if(_root._currentframe != this.frame)
- {
- this.removeMovieClip();
- }
- this.timer -= 2;
- if(this.timer <= 5)
- {
- this.removeMovieClip();
- }
- else
- {
- this._alpha = this.timer;
- }
- _root.maptest(this._name);
- this.mx += this.speed * this.x;
- this.my += this.speed * this.y;
- if(this.mx < this.minx || this.mx > this.maxx)
- {
- this.x *= -1;
- this.mx = this._x;
- }
- else
- {
- this._x = this.mx;
- }
- if(this.my > this.miny || this.my < this.maxy)
- {
- this.y *= -1;
- this.my = this._y;
- }
- else
- {
- this._y = this.my;
- }
- if(this.hitTest(_root.alien))
- {
- _root.enemies += 1;
- _root.alien.attachMovie("blowup","blowup",10000);
- _root.alien.gotoAndStop("off");
- _root.swarmarray[_root.scene] = 0;
- _root.score += 10;
- this.removeMovieClip();
- }
- i = 1;
- while(i <= this.swarmno)
- {
- if(this.hitTest(_root["swarm" + i]))
- {
- if(_root["swarm" + i].move)
- {
- _root.enemies += 1;
- _root["swarm" + i].move = false;
- _root["swarm" + i].attachMovie("blowup",blowup,10000);
- _root.swarmarray[_root.scene][0] -= 1;
- _root.score += 10;
- this.removeMovieClip();
- }
- }
- i++;
- }
- };
- }
- else if(_root.bulletnum == 3)
- {
- this.onLoad = function()
- {
- this.shapeX = this._x;
- this.shapeY = this._y;
- this.targetX = 0;
- this.targetY = 0;
- this.move = true;
- _root.homing = true;
- };
- this.onUnload = function()
- {
- delete _root.homing;
- };
- this.onEnterFrame = function()
- {
- if(this.move)
- {
- if(_root._currentframe != this.frame)
- {
- this.removeMovieClip();
- }
- if(this.swarmno == 0)
- {
- this.targetX = _root.alien._x;
- this.targetY = _root.alien._y;
- }
- else
- {
- i = 1;
- while(i <= this.swarmno)
- {
- this.targetX = _root["swarm" + i]._x;
- this.targetY = _root["swarm" + i]._y;
- i++;
- }
- }
- this.distX = this.targetX - this.shapeX;
- this.distY = this.targetY - this.shapeY;
- this.shapeX = Math.round(this.shapeX + this.DistX / 10);
- this.shapeY = Math.round(this.shapeY + this.DistY / 10);
- _root.maptest(this._name);
- if(this.shapeX < this.minx || this.shapeX > this.maxx || his.shapeY > this.miny || this.shapeY < this.maxy)
- {
- this.attachMovie("blowup","blowup",1000);
- this.move = false;
- }
- this._x = this.shapeX;
- this._y = this.shapeY;
- if(this.swarmno == 0)
- {
- if(this.hitTest(_root.alien))
- {
- _root.enemies += 1;
- _root.alien.attachMovie("blowup",blowup,10000);
- _root.alien.gotoAndStop("off");
- _root.score += 10;
- _root.swarmarray[_root.scene] = 0;
- this.removeMovieClip();
- }
- }
- else
- {
- i = 1;
- while(i <= this.swarmno)
- {
- if(_root["swarm" + i].move)
- {
- if(this.hitTest(_root["swarm" + i]))
- {
- _root.enemies += 1;
- this.removeMovieClip();
- _root["swarm" + i].move = false;
- _root["swarm" + i].attachMovie("blowup",blowup,10000);
- _root.score += 10;
- _root.swarmarray[_root.scene][0] -= 1;
- }
- }
- i++;
- }
- }
- }
- };
- }
- };
- bulletmove.prototype = new MovieClip();
- Object.registerClass("bullet",bulletmove);
- doorcheck2 = function()
- {
- this.takeoutwall = function()
- {
- this.gotoAndStop(2);
- _root["wall" + _root.keywall].gotoAndStop(2);
- _root["wall" + _root.keywall].maxx = 0;
- _root["wall" + _root.keywall].minx = 0;
- _root["wall" + _root.keywall].maxy = 0;
- _root["wall" + _root.keywall].miny = 0;
- };
- this.rununlockcheck = function()
- {
- if(_root.door2[this.name][1] == _root.currentitem[1])
- {
- this.gotoAndStop(2);
- _root.phatman1.removeMovieClip();
- _root.attachMovie("phatmanoff","phatmanoff1",95);
- _root.phatmanoff1._x = _root.phatlist[_root.scene][0];
- _root.phatmanoff1._y = _root.phatlist[_root.scene][1];
- _root.score += 25;
- _root.phatnum += 1;
- _root.removeitem();
- _root.item = "carrying " + _root.currentitem[0];
- _root.door2[this.name][0] = false;
- this.takeoutwall();
- }
- else if(!this.first)
- {
- this.first = true;
- _root.attachMovie("speech","speech1",2000);
- _root.speech1.gotoAndStop("item");
- _root.speech1._x = _root.phatman1._x;
- _root.speech1._y = _root.phatman1._y + 40;
- _root.speech1.itemname = _root.door2[this.name][1];
- }
- };
- this.onLoad = function()
- {
- this.name = this._name.slice(-1);
- this.checker = this._name.slice(-2,-1);
- this.checker = Number(this.checker);
- if(this.checker > 0)
- {
- this.name = this._name.slice(-2);
- }
- this.name = Number(this.name);
- delete this.checker;
- if(!_root.door2[this.name][0])
- {
- this.takeoutwall();
- }
- else
- {
- _root.attachMovie("phatman","phatman1",95);
- _root.phatman1._x = _root.phatlist[_root.scene][0];
- _root.phatman1._y = _root.phatlist[_root.scene][1];
- }
- };
- this.onEnterFrame = function()
- {
- if(this.hitTest(_root.hero))
- {
- this.rununlockcheck();
- }
- else if(this.first)
- {
- this.first = false;
- _root.speech1.removeMovieClip();
- }
- };
- };
- doorcheck2.prototype = new MovieClip();
- Object.registerClass("door2",doorcheck2);
- doorcheck = function()
- {
- this.rununlockcheck = function()
- {
- if(_root.doors[this.name][4] == _root.currentitem[1])
- {
- _root.score += 3;
- this.gotoAndStop("open");
- _root.doornum += 1;
- _root.removeitem();
- _root.doors[this.name][3] = false;
- this.otherdoor = _root.doors[this.name][1];
- _root.doors[this.otherdoor][3] = false;
- delete otherdoor;
- }
- else if(!this.first)
- {
- this.first = true;
- _root.attachMovie("speech","speech1",2000);
- _root.speech1.gotoAndStop(_root.doors[this.name][4]);
- _root.speech1.follow = true;
- _root.speech1._x = _root.hero._x;
- _root.speech1._y = _root.hero._y;
- }
- };
- this.rundoorcheck = function()
- {
- if(!_root.doors[this.name][3])
- {
- _root.scenechange(this.name);
- }
- };
- this.onLoad = function()
- {
- this.checker = this._name.slice(-2,-1);
- this.checker = Number(this.checker);
- this.checker2 = this._name.slice(-3,-2);
- this.checker2 = Number(this.checker2);
- if(this.checker2 > 0)
- {
- this.name = this._name.slice(-3);
- }
- else if(this.checker > 0)
- {
- this.name = this._name.slice(-2);
- }
- else
- {
- this.name = this._name.slice(-1);
- }
- delete checker;
- delete checker2;
- this.name = Number(this.name);
- if(_root.doors[this.name][3])
- {
- if(_root.doors[this.name][4] == "key")
- {
- this.gotoAndStop("key");
- }
- else if(_root.doors[this.name][4] == "keycard")
- {
- if(_root.doors[this.name][2] < 0)
- {
- this.gotoAndStop("keycardleft");
- }
- else
- {
- this.gotoAndStop("keycardright");
- }
- }
- else if(_root.doors[this.name][4] == "hallpass")
- {
- this.gotoAndStop(2);
- }
- else
- {
- this.gotoAndStop("locked");
- }
- }
- else
- {
- this.gotoAndStop(1);
- }
- };
- this.onEnterFrame = function()
- {
- if(this.hitTest(_root.hero))
- {
- if(_root.doors[this.name][3])
- {
- this.rununlockcheck();
- }
- if(Math.abs(_root.hero._x - this._x) < 10)
- {
- if(Math.abs(hero._y - this._y) < 25)
- {
- this.rundoorcheck();
- }
- }
- }
- else if(this.first)
- {
- this.first = false;
- _root.speech1.removeMovieClip();
- }
- };
- };
- doorcheck.prototype = new MovieClip();
- Object.registerClass("door",doorcheck);
- itemcheck = function()
- {
- this.onLoad = function()
- {
- this.name = this._name.slice(-1);
- this.checker = this._name.slice(-2,-1);
- this.checker = Number(this.checker);
- if(this.checker > 0)
- {
- this.name = this._name.slice(-2);
- }
- this.name = Number(this.name);
- delete this.checker;
- if(!_root.items[this.name][0])
- {
- this.attachMovie(_root.items[this.name][1],"inside",1);
- if(_root.items[this.name][0] != false)
- {
- this.onEnterFrame = function()
- {
- if(_root.items[this.name][0] != false)
- {
- if(Key.isDown(32) && this.pressed == false)
- {
- this.pressed = true;
- if(this.hitTest(_root.hero))
- {
- _root.pickup(this.name);
- _root.notfired = false;
- }
- }
- else if(!Key.isDown(32))
- {
- this.pressed = false;
- }
- }
- };
- }
- }
- };
- };
- itemcheck.prototype = new MovieClip();
- Object.registerClass("item",itemcheck);
-